package com.singfee.gisservice.controller;

import com.singfee.gisservice.entity.FieldInfo;
import com.singfee.gisservice.service.ILayerService;
import com.singfee.gisservice.entity.GeoLayer;

import io.micrometer.common.util.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

@RestController
@CrossOrigin
@RequestMapping("/layer")
public class LayerController {
    @Autowired
    ILayerService layerService;

    @GetMapping("/layerList")
    public List<GeoLayer> getLayerList() {
        return layerService.getLayerList();
    }

    @GetMapping("/fieldList")
    public List<FieldInfo> getFieldList(String lyrName) {
        if (StringUtils.isEmpty(lyrName))
        {
            return  null;
        }
        else
        {
            return  layerService.getFieldList(lyrName) ;
        }
    }


}
